﻿using System;
using System.Windows.Data;
using Csla;
using System.Globalization;

namespace BizControl.Presentation.StickyNotesModule.Converters
{
  public class MonthNumberToNameValueConverter : IValueConverter
  {
    #region IValueConverter Members

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      SmartDate date = new SmartDate();
      string month = string.Empty;
      if (SmartDate.TryParse(value.ToString(), ref date))
        month = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(date.Date.Month);
      return month;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      return null;
    }

    #endregion
  }
}
